<?php

class categoryMain{
	
	private $db;
	
	private $childrenList;
	private $categoryList;
	
	function __construct(){
		try {
		
			$this->db = pg_connect("host='".DB_HOST."' dbname='".DB_NAME."' user='".DB_USER."' password='".DB_PASS."'");
		}catch (Exception $e){
			echo $e->getMessage();
		}
				
		$this->setCategories();
		
		return 0;
	}
	
	
	
	function setCategories(){
		try {
			$query = "Select * from categories";
			$result = pg_query($this->db,$query);
			$row = pg_fetch_all($result);
		
		}catch (Exception $e){
			echo $e->getMessage();
		}
		$this->categoryList=$row;
		
	}
	
	
	function getCategoryList(){
		return $this->categoryList;
	}
	
}

?>